<?php

require_once 'access_token.php';
$img = "https://ldjx.ricke.cc/images/logo.png";
$data = [
    "account_id" => "7278581881396791351",
    "product" => [
        "account_name" => "蓝盾C2小型汽车2389",
        "attr_key_value_map" => [
            "appointment" => json_encode([
                "need_appointment" => true,
                "ahead_time_type" => 2,
                "ahead_hour_num" => 5,
                "external_link" => $img,
                "order_appointment_time_url" => $img
            ]),
            "auto_renew" => "false",
            'can_no_use_date' => json_encode([
                "enable" => true,
                "days_of_week" => [7, 1, 2, 3, 4],
                "holidays" => [1, 2, 3, 4, 5],
                "date_list" => ["2022-03-08", "2022-03-09"],
                "holiday_dates" => [
                    "1" => "2022.01.01-2022.01.03"
                ]
            ]),
            "customer_reserved_info" => json_encode([
                "allow" => false
            ]),
            "description_rich_text" => json_encode([
                [
                    "note_type" => 1,
                    "content" => '团购'
                ]
            ]),
            'detail_image_list' => json_encode([
                [
                    "url" => $img
                ]
            ]),
            "dishes_image_list" => json_encode([
                [
                    "url" => $img
                ]
            ]),
            'environment_image_list' => json_encode([
                [
                    'url' => $img
                ]
            ]),
            "FrontCategoryTag" => json_encode([
                "团购",
            ]),
            'image_list' => json_encode([
                [
                    "url" => $img
                ],
                [
                    "url" => $img
                ]
            ]),
            // "parking_lot_within_1km" => "true",
            "real_name_info" => json_encode([
                'enable' => false,
                'scene' => 0
            ]),
            "rec_person_num" => "1",
            "show_channel" => "1",
            "SortWeight" => "0",
            "superimposed_discounts" => "true",
            "TagList" => "标签列表-待填写",
            "Description"=>json_encode([]),
            "use_date" => json_encode([
                "use_date_type" => 1,
                "use_start_date" => "2024-07-01",
                "use_end_date" => "2024-12-31"
            ]),
            'use_time' => json_encode([
                "use_time_type" => 1
            ]),
            "bring_out_meal" => "false",
            "free_pack" => "true",
            "poi_list" => json_encode([
                [
                    "poi_id" => "6601145199865366531"
                ]
            ],JSON_UNESCAPED_UNICODE),
           
            "IndustryType" => "其他",
            "IsConfirmImme" => "true",
            "Notification" => json_encode([
                [
                    "title" => "标题",
                    "content" => "内容"
                ]
            ],),
            "RecommendWord" => "推荐语",

            "private_room" => "false",
            "rec_person_num_max" => "2",
            "RefundPolicy" => "1",
            "refund_need_merchant_confirm" => "false"
        ],
        "biz_line" => 5,
        "category_id" => 7001001,
        // "out_id"=>"",

        "pois" => [
            [
                "poi_id" => "6601145199865366531"
            ]
        ],
        "product_name" => "蓝盾C2小型汽车2389",
        "product_type" => 1,
        "sold_end_time" => 1721635602,
        "sold_start_time" => 1721635602,
        "telephone" => [
            "15220188931"
        ]

    ],
    "sku" => [
        "actual_amount" => 2389,
        "attr_key_value_map" => [
            "code_source_type" => "1",
            "commodity" => json_encode([
                [
                    "group_name" => "蓝盾",
                    "total_count" => 1,
                    "option_count" => 1,
                    "item_list" => [
                        [
                            "name" => "可乐",
                            "price" => 1998,
                            "count" => 1,
                            "unit" => "份"
                        ]
                    ]
                ]
            ]),
            "limit_rule" => json_encode([
                "is_limit" => true,
                "total_buy_num" => 9
            ]),
            "market_price" => "3000",
            "settle_type" => "1",
            "use_type" => "1",
            "stock_info" => json_encode([
                "limit_type" => 1,
                "stock_qty" => 10
            ])
        ],
        "origin_amount" => 3000,
        "sku_name" => "小型汽车",
        "status" => 1,
        "stock" => [
            "limit_type" => 1,
            "stock_qty" => 10
        ]
    ]
];
$res = post("https://open.douyin.com/goodlife/v1/goods/product/save/", $data);
// $res = post("https://open.douyin.com/life/goods/product/save/", $data);

echo $res;
exit;